package factory.kotlinMode.simpleFactory

import factory.kotlinMode.Computer

/**
 * 工厂类
 */
class ComputerFactory {
    /**
     * 常规写法
     */
    fun createCommon(computerType: ComputerType): Computer {
        return when (computerType) {
            ComputerType.PC -> PC("个人电脑,cpu i7")
            ComputerType.SERVER -> Sever("服务器,cpu i9")
        }
    }
}

enum class ComputerType {
    PC, SERVER
}